package com.yazi.mxz.common.entity.beans;

import com.myframework.smhj.hibernate.Entity;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * GoodsGift entity. @author MyEclipse Persistence Tools
 */
@javax.persistence.Entity
@Table(name = "MXZ_GOODS_GIFT", schema = "MXZ")
public class GoodsGift extends Entity implements java.io.Serializable {

	// Fields

	private GoodsGiftId id;
	private StoreGoods storeGoodsByGiftId;
	private StoreGoods storeGoodsBySellId;
	private Integer amount;

	// Constructors

	/** default constructor */
	public GoodsGift() {
	}

	/** full constructor */
	public GoodsGift(GoodsGiftId id, StoreGoods storeGoodsByGiftId,
			StoreGoods storeGoodsBySellId, Integer amount) {
		this.id = id;
		this.storeGoodsByGiftId = storeGoodsByGiftId;
		this.storeGoodsBySellId = storeGoodsBySellId;
		this.amount = amount;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "sellId", column = @Column(name = "SELL_ID", nullable = false, precision = 15, scale = 0)),
			@AttributeOverride(name = "giftId", column = @Column(name = "GIFT_ID", nullable = false, precision = 15, scale = 0)),
			@AttributeOverride(name = "type", column = @Column(name = "TYPE", nullable = false, precision = 8, scale = 0)) })
	public GoodsGiftId getId() {
		return this.id;
	}

	public void setId(GoodsGiftId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "GIFT_ID", nullable = false, insertable = false, updatable = false)
	public StoreGoods getStoreGoodsByGiftId() {
		return this.storeGoodsByGiftId;
	}

	public void setStoreGoodsByGiftId(StoreGoods storeGoodsByGiftId) {
		this.storeGoodsByGiftId = storeGoodsByGiftId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SELL_ID", nullable = false, insertable = false, updatable = false)
	public StoreGoods getStoreGoodsBySellId() {
		return this.storeGoodsBySellId;
	}

	public void setStoreGoodsBySellId(StoreGoods storeGoodsBySellId) {
		this.storeGoodsBySellId = storeGoodsBySellId;
	}

	@Column(name = "AMOUNT", nullable = false, precision = 8, scale = 0)
	public Integer getAmount() {
		return this.amount;
	}

	public void setAmount(Integer amount) {
		this.amount = amount;
	}

}